Repository navigation
Conversation
akx
left a comment
There was a problem hiding this comment.
Instead of using sys.intern, what about just having a temporary dict of these strings within the parser? That would work for free-threaded builds too.
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
4e96885 to
4da5393
Compare
|
Switched to a dict on the parser, dropped sys.intern and the build check, and cut the tests down to a single case in test_pofile_read.py. It only dedups within one read_po call now (e.g. the same msgid under different contexts), so separately loaded catalogs no longer share IDs. |
|
Hmmmn, sorry, I had forgotten to actually read the context of #571 before suggesting the per-parser dict. I'd just rather not like to have to probe around for whether we're doing free-threading... |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1395 +/- ##
=======================================
Coverage 93.51% 93.51%
=======================================
Files 27 27
Lines 4932 4936 +4
=======================================
+ Hits 4612 4616 +4
Misses 320 320
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
While reading a PO file,
PoFileParsernow keeps a dict of message ID strings, so an msgid or plural part that appears again in the same file (for example under a different msgctxt) reuses the first string object instead of keeping a duplicate. The dict only lives as long as the parser, so nothing is held globally.Refs #571.